﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TarreOA.TarreOABLL;
using TarreOA.TarreOAModels;

public partial class admin_AfficheInformSetting_AfficheInformConsult : System.Web.UI.Page {
    protected void Page_Load(object sender, EventArgs e) {
        if(!Page.IsPostBack) {
            if(Request.QueryString.Get("ai_id") != null) {
                int ai_id = int.Parse(Request.QueryString.Get("ai_id"));
                this.DataList_DataTable(ai_id);
            }
        }
    }

    protected void DataList_DataTable(int aiid) {
        AfficheInformtbService aiService = new AfficheInformtbService();
        List<AfficheInformConsulttb> list = aiService.findConsultByAiid(aiid);
        if(list != null) {
            DataTable dt = new DataTable();
            dt.Columns.Add("SectionId", typeof(string));
            dt.Columns.Add("SectionName", typeof(string));
            dt.Columns.Add("FinishUsersname", typeof(string));
            dt.Columns.Add("UnFinishUsersname", typeof(string));
            foreach(AfficheInformConsulttb aic in list) {
                DataRow dr = dt.NewRow();
                dr["SectionId"] = aic.SectionId.ToString();
                dr["SectionName"] = aic.SectionName;
                dr["FinishUsersname"] = aic.FinishUsernames;
                dr["UnFinishUsersname"] = aic.UnFinishUsernames;
                dt.Rows.Add(dr);
            }
            this.DataList1.DataSource = dt.DefaultView;
        } else {
            this.DataList1.DataSource = null;
        }
        this.DataList1.DataBind();
    }
}
